<?php

namespace Database\Seeders;

use App\Models\Setting\Setting;
use Illuminate\Database\Seeder;

class DefaultSettingSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $default_settings = [
            [
                "setting_key"   => "train_book_day",
                "setting_value" => "15",
                "setting_name"  => "火车票预售时间",
                "setting_desc"  => "",
            ], [
                "setting_key"   => "train_month",
                "setting_value" => "1",
                "setting_name"  => "月份",
                "setting_desc"  => "",
            ], [
                "setting_key"   => "train_book_service_fee",
                "setting_value" => "2.6",
                "setting_name"  => "购票服务费",
                "setting_desc"  => "",
            ], [
                "setting_key"   => "train_change_service_fee",
                "setting_value" => "15",
                "setting_name"  => "改签服务费",
                "setting_desc"  => "",
            ], [
                "setting_key"   => "train_refund_service_fee",
                "setting_value" => "15",
                "setting_name"  => "退款服务费",
                "setting_desc"  => "",
            ], [
                "setting_key"   => "train_snap_high_speed_service_fee",
                "setting_value" => "25",
                "setting_name"  => "高速抢票服务费",
                "setting_desc"  => "火车票高速抢票服务费",
            ],
        ];

        $setting = new Setting();
        foreach ($default_settings as $s) {
            if ($setting->getSetting($s['setting_key'])) {
                continue;
            }
            $setting->create($s);
        }

    }
}
